package com.epidata.exam.rest;

import java.util.List;

import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;

import com.epidata.exam.dao.EmployeeDao;
import com.epidata.exam.model.Employee;

/**
 * JAX-RS Example
 * 
 * This class produces a RESTful service to read the contents of the members table.
 */
@Path("/employees")
@RequestScoped
public class EmployeeResourceRESTService {
	@Inject
	private EmployeeDao<Employee> empleadoDao;

	@GET
	@Produces("text/xml")
	public List<Employee> listAllMembers() {
		final List<Employee> results = empleadoDao.getAllEmployees();
		return results;
	}

	@GET
	@Path("/{id:[0-9][0-9]*}")
	@Produces("text/xml")
	public Employee lookupMemberById(@PathParam("id") long id) {
		return empleadoDao.getEmployeeById(id);
	}
}
